// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Item{
    x: 0
    y: 0

    property variant numberPics: []
    property variant weekdayPics: []

    Component.onCompleted: {
        updateCalendar();
    }

    Timer{
        interval: 10000
        repeat: true
        running: true
        onTriggered: {
            updateCalendar();
        }
    }
    function updateCalendar(){
        var d = new Date();
        var m1 = Math.floor((d.getMonth()+1) / 10);
        var m2 = (d.getMonth()+1) % 10;
        var d1 = Math.floor(d.getDate() / 10);
        var d2 = d.getDate() % 10;
        var w = d.getDay();

        if(d.getMonth() >= 9){
            _m1.visible = true;
            _m1.source = numberPics[m1];
        }else{
            _m1.visible = false;
        }
        _m2.source = numberPics[m2];
        _d1.source = numberPics[d1];
        _d2.source = numberPics[d2];
        _w.source = weekdayPics[w];
    }

    //月と日と（）
    Image{
        x: 17 * viewScale
        y: 0 * viewScale
        width: 142 * viewScale
        height: 24 * viewScale
        smooth: true
        source: "images/lock_calendar_base.png"
    }
    //月
    Image{
        id: _m1
        x: 0 * viewScale
        y: 2 * viewScale
        width: 12 * viewScale
        height: 20 * viewScale
        smooth: true
        source: ""
    }
    Image{
        id: _m2
        x: 15 * viewScale
        y: 2 * viewScale
        width: 12 * viewScale
        height: 20 * viewScale
        smooth: true
        source: ""
    }
    //日
    Image{
        id: _d1
        x: 57 * viewScale
        y: 2 * viewScale
        width: 12 * viewScale
        height: 20 * viewScale
        smooth: true
        source: ""
    }
    Image{
        id: _d2
        x: 72 * viewScale
        y: 2 * viewScale
        width: 12 * viewScale
        height: 20 * viewScale
        smooth: true
        source: ""
    }
    //曜日
    Image{
        id: _w
        x: 125 * viewScale
        y: 0 * viewScale
        width: 24 * viewScale
        height: 24 * viewScale
        smooth: true
        source: ""
    }
}
